<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="/js/layui/css/layui.css" media="all">
  <script src="/js/jquery-2.2.4.js" type="text/javascript"></script>
</head>
<body>
<form class="layui-form" id="ifrom">
  <div class="layui-form-item">
    <label class="layui-form-label">种类名称</label>
    <div class="layui-input-block">
      <input type="text" name="shop_type_name" id="shop_type_name" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">备注</label>
    <div class="layui-input-block">
      <input type="text" name="shop_type_remark" id="shop_type_remark" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">排序顺序</label>
    <div class="layui-input-block">
      <input type="text" name="shop_type_order" id="shop_type_order" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button type="button" class="layui-btn" onclick="show()" >立即提交</button>
      <button type="submit" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
</form>

</body>
<script>

  function show(){
    $.ajax({
      async:false,
      url:"/shoptype/typesava",
      type:"post",
      data:$("#ifrom").serialize(),
      dataType:"json",
      success:function (data){
        if (data.code =="1" ){
          alert("新增成功")
          window.location.href="/shoptype/tiao";
        }else {
          alert("新增失败")
          window.location.reload();
        }
      }
    })
  }
</script>
</html>